package com.SouthernWall_404.AgeDust.Common.API.Capability;

import com.SouthernWall_404.AgeDust.Common.API.Enum.sexEnum;
import com.SouthernWall_404.AgeDust.Common.API.Enum.raceEnum;
import com.SouthernWall_404.AgeDust.Common.API.Info.AttributesInfo;
import com.SouthernWall_404.AgeDust.Common.API.Info.CharacterInfo;
import com.SouthernWall_404.AgeDust.Common.API.Util.NBTHandler;
import com.SouthernWall_404.AgeDust.Common.AgeDust;
import net.minecraft.nbt.CompoundTag;
;

public class PlayerPersonality {

    public CharacterInfo characterInfo =new CharacterInfo("null",sexEnum.male,raceEnum.human,18);
    public AttributesInfo attributesInfo=new AttributesInfo();

    public void copyfrom (PlayerPersonality other)
    {
        this.characterInfo=other.characterInfo;
        this.attributesInfo=other.attributesInfo;
    }
    public void saveNBT(CompoundTag nbt)
    {
        CompoundTag modPack=NBTHandler.createModPack(characterInfo,attributesInfo);
        nbt.put(AgeDust.MODID,modPack);

    }
    public void readNBT(CompoundTag nbt)
    {
        CompoundTag modPack=(CompoundTag) nbt.get(AgeDust.MODID);;
        if(modPack.isEmpty())
        {
            characterInfo =new CharacterInfo("steve",sexEnum.male,raceEnum.human,18);
            attributesInfo=new AttributesInfo();
            return;
        }
        else
        {
            characterInfo =NBTHandler.loadCharacterFromModPack(modPack);
            attributesInfo=NBTHandler.loadAttributeFromModPack(modPack);
        }
    }

}
